/*
@author: feng
@date: 2021/7/11 10:34
@Version: 1.0
@last modifined by : 2021/7/11 10:34
@last Modifined time : 2021/7/11 10:34
*/
import React from 'react';
import { Form } from 'antd';
import SForm, { SFields } from '@C/base/SForm';
// import { funny } from '@/api/mock';
import './test.less';
import './index.scss'
import './index.css'

const TestPage = () => {
  const [useForm] = Form.useForm();
  const [useForm1] = Form.useForm();

  // const useFormInstance = Form.useFormInstance();
  // const useWatch = Form.useWatch('one', useForm);

  // const RadioList = [
  //   { label: 'A', value: 'A', },
  //   { label: 'B', value: 'B', disabled: true },
  //   { label: 'C', value: 'C', },
  // ];

  // useEffect(() => {
  //   funny().then((res) => {
  //     console.log(res);
  //   })
  // }, []);

  return (
    <>
      <SForm
        footerBtnType="search"
        form={useForm}
        autoComplete
        onSubmit={(validate) => {
          console.log('validate: ', validate);
        }}
        // eventBtnConfig={{
        //   hideCancelBtn: true
        // }}
      >
        <SFields.SSelect name="one" required />
        <SFields.RadioGroup name="RadioGroup"/>
        <SFields.CheckboxGroup name="CheckboxGroup"/>
        <SFields.TextArea name="three" />
      </SForm>

      <SForm
        name="test"
        form={useForm1}
        autoComplete
        onSubmit={(validate, getFormInstance) => {
          console.log('getFormInstance: ', getFormInstance());
          console.log('测试表单2 validate: ', validate);
        }}
        onCancel={() => {
          console.log('返回');
        }}
      >
        <SFields.Input name="one" required/>
        <SFields.Input name="two" />
        <SFields.Input name="three" />
      </SForm>
    </>
  );
};

export default TestPage;
